package com.qboot.common.controller;

import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试 Bean 注入
 *
 * @author Tellsea
 * @date 2023/3/10
 */
@Api(tags = "测试事物")
@RestController
@RequestMapping("/test/testBean")
@RequiredArgsConstructor(onConstructor_ = @Autowired)
public class TestBeanController {

    private final ApplicationContext applicationContext;

    @GetMapping("")
    public void testBean() {
        String[] beanDefinitionNames = applicationContext.getBeanDefinitionNames();
        for (String name : beanDefinitionNames) {
            if (name.contains("Aspect")) {
                System.out.println(name);
            }
        }
    }
}
